import {
    list,
    saveNotice,
    getNoticeById,
    enabledControl
} from '@/services/settings/notice/noticeService';

export default {
    namespace: 'noticeModel',

    state: {},

    effects: {
        *list({payload, callback}, {call, put}) {
            const response = yield call(list, payload);
            if (callback) callback(response);
        },
        *saveNotice({payload, callback}, {call, put}) {
            const response = yield call(saveNotice, payload);
            if (callback) callback(response);
        },
        *getNoticeById({payload, callback}, {call, put}) {
            const response = yield call(getNoticeById, payload);
            if (callback) callback(response);
        },
        *enabledControl({payload, callback}, {call, put}) {
            const response = yield call(enabledControl, payload);
            if (callback) callback(response);
        },
    },

    reducers: {},
};
